
package com.bash.carrep.dao.enties;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bash
 */
@Entity
@Table(name = "typeoperation", catalog = "carrepdb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TypeOperation.findAll", query = "SELECT t FROM TypeOperation t"),
    @NamedQuery(name = "TypeOperation.findByIdTypeOperation", query = "SELECT t FROM TypeOperation t WHERE t.idTypeOperation = :idTypeOperation"),
    @NamedQuery(name = "TypeOperation.findByLibele", query = "SELECT t FROM TypeOperation t WHERE t.libele = :libele")})
public class TypeOperation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idTypeOperation", nullable = false)
    private Integer idTypeOperation;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "libele", nullable = false, length = 45)
    private String libele;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTypeOperation")
    private List<OperationEffectue> operationEffectueList;

    public TypeOperation() {
    }

    public TypeOperation(Integer idTypeOperation) {
        this.idTypeOperation = idTypeOperation;
    }

    public TypeOperation(Integer idTypeOperation, String libele) {
        this.idTypeOperation = idTypeOperation;
        this.libele = libele;
    }

    public Integer getIdTypeOperation() {
        return idTypeOperation;
    }

    public void setIdTypeOperation(Integer idTypeOperation) {
        this.idTypeOperation = idTypeOperation;
    }

    public String getLibele() {
        return libele;
    }

    public void setLibele(String libele) {
        this.libele = libele;
    }

    @XmlTransient
    public List<OperationEffectue> getOperationEffectueList() {
        return operationEffectueList;
    }

    public void setOperationEffectueList(List<OperationEffectue> operationEffectueList) {
        this.operationEffectueList = operationEffectueList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTypeOperation != null ? idTypeOperation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeOperation)) {
            return false;
        }
        TypeOperation other = (TypeOperation) object;
        if ((this.idTypeOperation == null && other.idTypeOperation != null) || (this.idTypeOperation != null && !this.idTypeOperation.equals(other.idTypeOperation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bash.carrep.dao.enties.TypeOperation[ idTypeOperation=" + idTypeOperation + " ]";
    }
    
}
